<?php

namespace App\Model;


use Illuminate\Support\Facades\DB;

class LootingGifts extends BaseModel
{
    protected $connection = 'api';
    protected $table = 'looting_gift';


    public function getList($input = [])
    {
        $limit = $input['limit'] ?? 10;
        $res = DB::connection($this->connection)->table($this->table)
            ->paginate($limit);
        return $this->objToArray($res);
    }

    public function createOrUpdateData($data){
        return curl_request(getKkaudioApiUrl() . '/inner/looting/gift/upsert', $data, 'json', 'POST');
    }

    public function delGift($id){
        return curl_request(getKkaudioApiUrl() . '/inner/looting/gift/del', ['id' => $id], 'urlencoded', 'GET');
    }

}
